<?php 

session_start();

$user = $_SESSION['session_key'];
global $db;
global $user_details;

$query = 'SELECT * FROM USERS WHERE `ID`='.$user;
$result = $db->query($query); 
$isUser = $result->num_rows;
if($isUser){
    $user = $result->fetch_assoc();
    $user_details['name'] = $user['FirstName'];
    $user_details['lastname'] = $user['LastName'];
    $user_details['email'] = $user['Email'];
    $user_details['phone'] = $user['Phone'];
    $user_details['id'] = $user['ID'];
}

?>